import { createRouter, createWebHistory } from 'vue-router'
import StudentManagement from './views/StudentManagement.vue'
import Login from './views/Login.vue'
import Tab2 from './views/Tab2.vue'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    { path: '/', redirect: '/students' },
    { path: '/login', component: Login },
    { path: '/students', component: StudentManagement },
    { 
      path: '/about',
      component: () => import('./views/About.vue'),
      children: [
        { path: '/about/tab1', component: () => import('./views/Tab1.vue')},
        { path: '/about/tab2', component: Tab2 }
      ]
    },
    {
      path: '/student-edit/:studentNo',
      component: () => import('./views/StudentEdit.vue'),
      props: true
    },
    {
      path: '/students/new-student',
      component: () => import('./views/StudentAdd.vue')
    }
  ]
})

export default router